package com.easytouch.vm.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.easytouch.core.utils.Log;
import com.easytouch.core.utils.SystemTools;
import com.easytouch.vm.activity.SplashActivity;


public class BootBroadcastReceiver extends BroadcastReceiver {

	Log mLogger = new Log("BootBroadcastReceiver.txt");

	@Override
	public void onReceive(Context context, Intent intent) {
		String broadAction = intent.getAction();
		if ("android.intent.action.BOOT_COMPLETED".equals(broadAction)) {
			mLogger.i("Receive BootBroadcast");
			String action = "android.intent.action.MAIN";
			String category = "android.intent.category.LAUNCHER";
			Intent startIntent = new Intent(context, SplashActivity.class);
			startIntent.setAction(action);
			startIntent.addCategory(category);
			startIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			context.startActivity(startIntent);
		}
		else if("com.easytouch.REBOOT".equals(broadAction))
		{
			SystemTools.reboot();
		}
	}

}
